package com.springvn.sample.services.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.springvn.sample.dao.IEmployeeDAO;
import com.springvn.sample.persistence.Employee;
import com.springvn.sample.services.IEmployeeService;

@Service
@Transactional
public class EmployeeService implements IEmployeeService{
	
	@Autowired
	private IEmployeeDAO employeeDao;
	
	@Override
	public void addEmployee(Employee entity) {
		this.employeeDao.save(entity);
		
	}

	@Override
	public List<Employee> getAllEmployees() {
		return this.employeeDao.findAll();
	}

	@Override
	public void deleteEmployee(Integer employeeId) {
		this.employeeDao.removeById(employeeId);
		
	}

}
